import 'package:flutter/material.dart';
import 'package:flutter_09_game/generated/locales.g.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_09_game/config/app_color.dart';
import 'package:get/get.dart';

class WidgetRoundBall extends StatelessWidget {
  const WidgetRoundBall(
      {super.key,
      required this.result,
      this.isBig = true,
      this.isBorder = false});

  final int? result;
  final bool isBig;
  final bool isBorder;

  @override
  Widget build(BuildContext context) {
    // 判断单双：奇数为单，偶数为双
    bool isOdd = (result ?? 0) % 2 == 1;
    Color color =
        isOdd ? AppColor.homePrizePoolIndicator : AppColor.gameResultEven;
    return Container(
      width: isBig ? 20.w : 16.w,
      height: isBig ? 20.w : 16.w,
      decoration: BoxDecoration(
        shape: BoxShape.circle,
        border: Border.all(
          width: 1,
          color: isBorder ? color : Colors.transparent,
        ),
        color: isBorder ? color.withOpacity(0.5) : color,
        // isOdd ? AppColor.homePrizePoolIndicator : AppColor.gameResultEven,
      ),
      child: Align(
        alignment: Alignment.center,
        child: DefaultTextStyle(
          textAlign: TextAlign.center,
          style: TextStyle(
            fontFamily: 'PingFang SC',
            fontWeight: FontWeight.w600,
            fontSize: isBig ? 12.sp : 10.sp,
            color: AppColor.textPrimary,
            height: 1.0, // 设置行高为1.0，消除额外间距
          ),
          child: Text(
            isOdd ? LocaleKeys.single.tr : LocaleKeys.double.tr,
            textAlign: TextAlign.center,
          ),
        ),
      ),
    );
  }
}
